import requests
import time
import sys
sys.path.append("../")
from model.StockBaseInfo import *
from frameworks.utils.PrettyTableUtil import *
import time
"""
#f2:最新价 f3:涨幅 f4:涨跌额 f5:成交量 f6成交额 f7:振幅
#f8:换手率 f9:市盈率 f10:量比 f11: f12:代码 f14:股票名称 f15:最高
#f16:最低 f17:今开 f18:昨收 f20:总市值 f21:流通市值
#f22:
"""

base = StockBaseInfo()
def getMiniteData(code):
    time.sleep(0.1)
    klineday = base.getDfcfLineDay(code,30)
    if "klines" in klineday:
        i = 1
        score = 0
        for row in klineday["klines"]:
            daydata = row.split(",")
            zf = round(float(daydata[8])/100,2)
            score += zf*i
            i += 1
        return round(score,2)
    return 0

print(getMiniteData("600103"))